Transmission Control Protocol (TCP) enables two nodes to establish a reliable connection and exchange streams of information over a network. Each stream of information may be split into TCP segments (“segments”) at a transport layer that are each sent across the network as separate Internet Protocol (IP) packets (“packets” or “datagrams”) at a network layer. When sent from a source to a destination, a TCP segment includes a sequence number and an acknowledgment number. The sequence number indicates a byte number for the first byte of information in the segment. The acknowledgment number indicates a byte number for the first byte of the next segment that the destination expects to receive from the source. The destination can use the sequence number associated with each segment to assemble the segments in the proper order.
When the destination receives a segment, it sends an acknowledgment to the source indicating the byte of the last segment that it has received and contiguously assembled in the stream. This acknowledgment indicates to the source that the destination has received all bytes up to and including the acknowledgment number minus one. The destination may also (or instead) send an acknowledgment of a non-contiguous segment through a mechanism such as Selective Acknowledgment (SACK).
If the source does not receive an acknowledgment for a sent segment within a certain amount of time or receives multiple duplicate acknowledgments, the source may assume that the segment has been lost in transmission to the destination and resend the segment. This certain amount of time can change dynamically, increasing (via an exponential backoff algorithm) with each lost segment to effectively allow more time for a subsequently sent segment to reach the destination and for the destination to acknowledge receipt of the subsequently sent segment.
TCP tunnels may be used when a packet traverses through at least one gateway device between a packet's original source and its ultimate destination. A TCP tunnel, which is essentially another TCP transmission layer, may provide security for and improve reliability of TCP packets tunneling through it. However, for TCP packets that are lost in sections not covered by the TCP tunnel, an end-to-end retransmission of packets may still be needed.